﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Text;
using System.IO;
using System.Xml;
using System.Data;

using Gift.DAL;
using Gift.Model;

public partial class cn_member_center_online_pay :BasePage
{

    protected string xmlPath = "/cn/xml/payment.xml";

    // Methods
    protected void Page_Load(object sender, EventArgs e)
    {
        if (HttpContext.Current.Session["user"] == null)
        {
            base.Response.Redirect("/cn/web_login.html?ru=" + HttpContext.Current.Request.Url.PathAndQuery.Replace("aspx", "html"));
        }
    }

    protected StringBuilder PaymentBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            string attribute = "";
            XmlDocument document = new XmlDocument();
            document.Load(base.Server.MapPath(this.xmlPath));
            XmlNodeList childNodes = document.SelectSingleNode("paymentMethod").ChildNodes;
            foreach (XmlNode node in childNodes)
            {
                XmlElement element = (XmlElement)node;
                if (element.GetAttribute("checked") == "true")
                {
                    attribute = element.GetAttribute("id");
                    break;
                }
            }
            builder.AppendLine("<table>");
            switch (attribute)
            {
                case "1":
                    builder.AppendLine("<tr>");
                    builder.AppendLine("<td colspan=\"3\" class=\"firsttd\"><strong>支付方式：</strong><span id=\"spPay_bank\"></span></td>");
                    builder.AppendLine("</tr>");
                    builder.AppendLine("<tr>");
                    builder.AppendLine("<td colspan=\"3\"><input type=\"radio\" name=\"pay_bank\" value=\"directPay\" checked=\"checked\" /><img src=\"/cn/payment/alipay_1.gif\" alt=\"支付宝\" /></td>");
                    builder.AppendLine("</tr>");
                    builder.AppendLine("<tr>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"ICBCB2C\" /><img src=\"/cn/payment/ICBC_OUT.gif\" alt=\"中国工商银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"CMB\" /><img src=\"/cn/payment/CMB_OUT.gif\" alt=\"招商银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"CCB\" /><img src=\"/cn/payment/CCB_OUT.gif\" alt=\"中国建设银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"BOCB2C\" /><img src=\"/cn/payment/BOC_OUT.gif\" alt=\"中国银行\" /></td>");
                    builder.AppendLine("</tr>");
                    builder.AppendLine("<tr>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"ABC\" /><img src=\"/cn/payment/ABC_OUT.gif\" alt=\"中国农业银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"COMM\" /><img src=\"/cn/payment/COMM_OUT.gif\" alt=\"交通银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"SPDB\" /><img src=\"/cn/payment/SPDB_OUT.gif\" alt=\"浦发银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"GDB\" /><img src=\"/cn/payment/GDB_OUT.gif\" alt=\"广东发展银行\" /></td>");
                    builder.AppendLine("</tr>");
                    builder.AppendLine("<tr>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"CITIC\" /><img src=\"/cn/payment/CITIC_OUT.gif\" alt=\"中信银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"CEBBANK\" /><img src=\"/cn/payment/CEB_OUT.gif\" alt=\"中国光大银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"CIB\" /><img src=\"/cn/payment/CIB_OUT.gif\" alt=\"兴业银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"SDB\" /><img src=\"/cn/payment/SDB_OUT.gif\" alt=\"深圳发展银行\" /></td>");
                    builder.AppendLine("</tr>");
                    builder.AppendLine("<tr>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"CMBC\" /><img src=\"/cn/payment/CMBC_OUT.gif\" alt=\"中国民生银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"HZCBB2C\" /><img src=\"/cn/payment/HZCB_OUT.gif\" alt=\"杭州银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"SHBANK\" /><img src=\"/cn/payment/SHBANK_OUT.gif\" alt=\"上海银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"NBBANK\" /><img src=\"/cn/payment/NBBANK_OUT.gif\" alt=\"宁波银行\" /></td>");
                    builder.AppendLine("</tr>");
                    builder.AppendLine("<tr>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"SPABANK\" /><img src=\"/cn/payment/SPABANK_OUT.gif\" alt=\"平安银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"BJRCB\" /><img src=\"/cn/payment/BJRCB_OUT.gif\" alt=\"北京农村商业银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"ICBCBTB\" /><img src=\"/cn/payment/ENV_ICBC_OUT.gif\" alt=\"中国工商银行(企业)\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"CCBBTB\" /><img src=\"/cn/payment/ENV_CCB_OUT.gif\" alt=\"中国建设银行(企业)\" /></td>");
                    builder.AppendLine("</tr>");
                    builder.AppendLine("<tr>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"SPDBB2B\" /><img src=\"/cn/payment/ENV_SPDB_OUT.gif\" alt=\"浦发银行(企业)\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"ABCBTB\" /><img src=\"/cn/payment/ENV_ABC_OUT.gif\" alt=\"中国农业银行(企业)\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"fdb101\" /><img src=\"/cn/payment/FDB_OUT.gif\" alt=\"富滇银行\" /></td>");
                    builder.AppendLine("<td><input type=\"radio\" name=\"pay_bank\" value=\"PSBC-DEBIT\" /><img src=\"/cn/payment/PSBC_OUT.gif\" alt=\"中国邮政储蓄银行\" /></td>");
                    builder.AppendLine("</tr>");
                    break;

                case "2":
                    builder.AppendLine("<tr>");
                    builder.AppendLine("<td colspan=\"3\"><input type=\"radio\" name=\"pay_bank\" value=\"Paypal\" checked=\"checked\" /><img src=\"/cn/payment/paypal.gif\" alt=\"Paypal\" /></td>");
                    builder.AppendLine("</tr>");
                    break;
            }
            builder.AppendLine("</table>");
        }
        catch
        {
        }
        return builder;
    }

}